/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('smart-subtitle', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model AddGameVideoTaskRequest {
  customVideoId?: string(name='CustomVideoId'),
  roomId?: string(name='RoomId'),
  UID?: string(name='UID'),
  videoList?: string(name='VideoList'),
  videoTemplate?: string(name='VideoTemplate'),
  videoType?: long(name='VideoType'),
}

model AddGameVideoTaskResponseBody = {
  code?: long(name='Code'),
  data?: long(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', description='Id of the request'),
  successResponse?: boolean(name='SuccessResponse'),
}

model AddGameVideoTaskResponse = {
  headers: map[string]string(name='headers'),
  body: AddGameVideoTaskResponseBody(name='body'),
}

async function addGameVideoTaskWithOptions(request: AddGameVideoTaskRequest, runtime: Util.RuntimeOptions): AddGameVideoTaskResponse {
  Util.validateModel(request);
  var body : map[string]any= {};
  if (!Util.isUnset(request.customVideoId)) {
    body['CustomVideoId'] = request.customVideoId;
  }
  if (!Util.isUnset(request.roomId)) {
    body['RoomId'] = request.roomId;
  }
  if (!Util.isUnset(request.UID)) {
    body['UID'] = request.UID;
  }
  if (!Util.isUnset(request.videoList)) {
    body['VideoList'] = request.videoList;
  }
  if (!Util.isUnset(request.videoTemplate)) {
    body['VideoTemplate'] = request.videoTemplate;
  }
  if (!Util.isUnset(request.videoType)) {
    body['VideoType'] = request.videoType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'AddGameVideoTask',
    version = '2020-12-17',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function addGameVideoTask(request: AddGameVideoTaskRequest): AddGameVideoTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  return addGameVideoTaskWithOptions(request, runtime);
}

model DownloadReportRequest {
  endTime?: string(name='EndTime'),
  startTime?: string(name='StartTime'),
  type?: string(name='Type'),
  userId?: string(name='UserId'),
}

model DownloadReportResponseBody = {
  dashboard?: [ 
    {
      aliyunId?: string(name='AliyunId'),
      duration?: string(name='Duration'),
      roomId?: string(name='RoomId'),
      time?: string(name='Time'),
    }
  ](name='Dashboard'),
  errorMsg?: string(name='ErrorMsg'),
  excelUrl?: string(name='ExcelUrl'),
  requestId?: string(name='RequestId'),
  total?: string(name='Total'),
}

model DownloadReportResponse = {
  headers: map[string]string(name='headers'),
  body: DownloadReportResponseBody(name='body'),
}

async function downloadReportWithOptions(request: DownloadReportRequest, runtime: Util.RuntimeOptions): DownloadReportResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DownloadReport',
    version = '2020-12-17',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function downloadReport(request: DownloadReportRequest): DownloadReportResponse {
  var runtime = new Util.RuntimeOptions{};
  return downloadReportWithOptions(request, runtime);
}

model GetGameVideoTaskInfoRequest {
  taskId?: long(name='TaskId'),
}

model GetGameVideoTaskInfoResponseBody = {
  code?: long(name='Code'),
  data?: {
    customVideoId?: string(name='CustomVideoId'),
    roomId?: string(name='RoomId'),
    taskId?: long(name='TaskId'),
    UID?: string(name='UID'),
    videoList?: string(name='VideoList'),
    videoTemplate?: string(name='VideoTemplate'),
    videoType?: long(name='VideoType'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', description='Id of the request'),
  successResponse?: boolean(name='SuccessResponse'),
}

model GetGameVideoTaskInfoResponse = {
  headers: map[string]string(name='headers'),
  body: GetGameVideoTaskInfoResponseBody(name='body'),
}

async function getGameVideoTaskInfoWithOptions(request: GetGameVideoTaskInfoRequest, runtime: Util.RuntimeOptions): GetGameVideoTaskInfoResponse {
  Util.validateModel(request);
  var body : map[string]any= {};
  if (!Util.isUnset(request.taskId)) {
    body['TaskId'] = request.taskId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetGameVideoTaskInfo',
    version = '2020-12-17',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getGameVideoTaskInfo(request: GetGameVideoTaskInfoRequest): GetGameVideoTaskInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return getGameVideoTaskInfoWithOptions(request, runtime);
}

model GetGameVideoTaskResultRequest {
  taskId?: long(name='TaskId'),
}

model GetGameVideoTaskResultResponseBody = {
  code?: long(name='Code'),
  data?: string(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', description='Id of the request'),
  successResponse?: boolean(name='SuccessResponse'),
}

model GetGameVideoTaskResultResponse = {
  headers: map[string]string(name='headers'),
  body: GetGameVideoTaskResultResponseBody(name='body'),
}

async function getGameVideoTaskResultWithOptions(request: GetGameVideoTaskResultRequest, runtime: Util.RuntimeOptions): GetGameVideoTaskResultResponse {
  Util.validateModel(request);
  var body : map[string]any= {};
  if (!Util.isUnset(request.taskId)) {
    body['TaskId'] = request.taskId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetGameVideoTaskResult',
    version = '2020-12-17',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getGameVideoTaskResult(request: GetGameVideoTaskResultRequest): GetGameVideoTaskResultResponse {
  var runtime = new Util.RuntimeOptions{};
  return getGameVideoTaskResultWithOptions(request, runtime);
}

model GetGameVideoTaskStatusRequest {
  taskId?: long(name='TaskId'),
}

model GetGameVideoTaskStatusResponseBody = {
  code?: long(name='Code'),
  data?: long(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', description='Id of the request'),
  successResponse?: boolean(name='SuccessResponse'),
}

model GetGameVideoTaskStatusResponse = {
  headers: map[string]string(name='headers'),
  body: GetGameVideoTaskStatusResponseBody(name='body'),
}

async function getGameVideoTaskStatusWithOptions(request: GetGameVideoTaskStatusRequest, runtime: Util.RuntimeOptions): GetGameVideoTaskStatusResponse {
  Util.validateModel(request);
  var body : map[string]any= {};
  if (!Util.isUnset(request.taskId)) {
    body['TaskId'] = request.taskId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetGameVideoTaskStatus',
    version = '2020-12-17',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getGameVideoTaskStatus(request: GetGameVideoTaskStatusRequest): GetGameVideoTaskStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return getGameVideoTaskStatusWithOptions(request, runtime);
}

